Skip to content

feat(dashboard): 补齐外置客户端桥接能力 - #621

Merged
deepcoldy merged 7 commits into
masterfrom
feat/desktop-ide-mobile-botmux-bridge
Jul 27, 2026
Merged

feat(dashboard): 补齐外置客户端桥接能力#621
deepcoldy merged 7 commits into
masterfrom
feat/desktop-ide-mobile-botmux-bridge

Conversation

@sensuossss

Copy link
Copy Markdown
Collaborator

背景

Desktop 与 Mobile 客户端已经拆到独立仓库维护,botmux daemon 需要提供稳定、可探测的 Dashboard/会话桥接契约,同时明确 Workflow 与 Web Terminal 的客户端边界。

改动内容

  • /__desktop/compat 升级为 Dashboard Protocol v2,返回运行时机器身份、模块清单和细粒度 capability;Workflow 明确标记为不支持。
  • 为嵌入式 Desktop/Mobile Dashboard 增加 client shell 边界,隐藏 Workflow,并将 Web Terminal 交由原生客户端会话入口处理。
  • 扩展 /api/sessions 的展示字段:按缓存补充机器人头像、Git 仓库名和分支,旧消费者可继续忽略新增字段。
  • 新增 pending ask 聚合与 Desktop 可信操作者答复接口,让外置客户端能够展示和处理待回答问题。
  • Web Terminal 重新 attach tmux 时恢复 window-size=latest,避免共享窗口遗留手动尺寸导致终端无法自适应。

影响面

  • Dashboard/daemon:兼容清单与会话 API 为增量扩展;嵌入式 shell 会收紧 Workflow/Web Terminal 路由。
  • CLI:未修改任何 CLI adapter;20+ CLI 的启动与输入路径不受影响。
  • 后端/会话:PTY、Zellij 与普通话题/群会话路径未修改;仅 tmux Web Terminal attach 增加尺寸恢复。
  • 平台:Git 信息探测同时兼容 macOS/Linux,带并发上限、超时与正/负缓存,不阻塞会话主列表。
  • UI:没有新增独立视觉页面,主要是外置客户端能力探测与嵌入边界调整,因此未附单独截图。

验证

  • pnpm build
  • pnpm test -- test/dashboard-sessions-ui.test.ts test/desktop/dashboard-client-shell.test.ts test/desktop/dashboard-compat.test.ts test/session-row-enrichment.test.ts test/web-terminal-tmux-window-size.test.ts ✅ 5 files / 41 tests
  • git merge-tree --write-tree origin/master HEAD ✅ 与最新 master 预合并无冲突
  • pnpm test ⚠️ 639 files / 9942 tests 通过;另有 2 个未改动测试文件中的 9 条失败:test/v3-distillation-runner.test.ts 受当前环境凭证/路由变量影响,test/vc-meeting-daemon-session.test.ts 出现超时与远端路由断言失败。相关 Dashboard/Session/Tmux 回归均通过。

@sensuossss
sensuossss requested a review from deepcoldy as a code owner July 27, 2026 11:54
滕鹏飞 and others added 4 commits July 27, 2026 21:18
bootstrap() 之前是「建 EventSource → 等 onopen(10s 超时)→ 才拉快照」,
失败路径还 es.close()。SSE 经反代(nginx 默认 proxy_buffering on)或平台隧道
被缓冲时,快照根本不会去拉,页面停在空列表;close() 又掐掉了 EventSource
自带的重连,用户不手动刷新就再也回不来——把「丢实时更新」的降级放大成了全挂。

改成:首屏快照立刻拉,不等 onopen;改为在每次 open(含第一次)上做一次
reconcile。第一次也要 reconcile 是因为 new EventSource 不等于服务端监听已
建立,先于订阅生成的快照可能漏掉窗口期的事件——这正是原来等 open 想保证的
性质,用 reconcile 换个方式拿回来。失败时保留流不关,交给 EventSource 自己
重连,open 处理器负责恢复。代价是首屏多一轮快照请求。

顺带两处:
- syncSubscriptions 的头像回填双向生效,bot 清空头像时不再残留旧图。
- 修正 session-presentation 的注释:idle/limited 边界的刷新是每会话每轮一次
  git rev-parse(有并发上限兜底),不是 "low-frequency" 的后台轮询。
review PR #621 发现:window-size 从 latest 改成 largest 时(commit 3d6935f),
配套的 test/web-terminal-tmux-window-size.test.ts 被一并删掉,导致该行改动零
测试覆盖。补回该文件并对齐当前实现——断言 `largest`(共享观看场景下不让新
attach 的小窗口缩小所有客户端)+ `timeout: 3000`(tmux 控制 socket 卡住时不
阻塞 attach)。

pnpm build ✅ / 该测试单跑 1 passed ✅

Co-Authored-By: Claude <noreply@anthropic.com>

@deepcoldy deepcoldy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed in an isolated worktree off PR head. pnpm build ✅ and the PR's 11 dashboard/session/tmux test files (162 tests) all pass; PR is cleanly based on latest master with green CI.

Verified the security-sensitive surfaces:

  • New /api/asks/* routes are fail-closed: browser side gated by decideDashboardAuth management token (not on the public allow-list), aggregator→daemon hop signs the route-bound trusted-host HMAC.
  • gitBranch is redacted from the public /api/sessions + /events surfaces (incl. session.update patches).
  • Git enrichment uses execFile (no shell), with timeout + concurrency cap + positive/negative TTL cache; worktree/detached/non-repo boundaries all correct.
  • SSE first-paint reconcile buffers races and converges deletes on every open (newer-wins), covered by tests.

Follow-up pushed on top (e2e2b77): restored the test/web-terminal-tmux-window-size.test.ts that had been dropped when window-size changed latest→largest, so that line is covered again.

Note for the author: the PR description still says window-size=latest — the code is largest. Please sync the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants